<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>dom-class &lsaquo; KISSY Docs</title>
<link rel="stylesheet" href="../assets/base-min.css" />
<link rel="stylesheet" href="../assets/docs.css" />
</head>
<body class="w866">
<div id="header">
    <a class="logo" href="../index.html"><img src="../assets/logo.png" alt="KISSY" width="138" height="74" /></a>
    <p class="rel-nav">
        <a href="http://github.com/kissyteam/kissy/src/dom/dom-class.js"><code>dom-class.js</code></a>
    </p>
</div>
<div id="content" class="layout grid-s232m0">
    <div class="col-main">
        <div class="main-wrap">

            <div class="section">
                <h3 id="methods">Methods</h3>

                <div class="member method">
                    <h4>
                        <a name="method_hasClass">hasClass</a>
                        <code>Boolean <em>hasClass</em> ( selector, value )</code>
                    </h4>
                    <div class="detail">
                        <p>判断符合选择器的所有元素中是否有某个元素含有特定 class.</p>
                        <p class="tips">只要某一个元素满足条件，就返回 true.</p>
                    </div>
                </div>

                <div class="member method">
                    <h4>
                        <a name="method_addClass">addClass</a>
                        <code>void <em>addClass</em> ( selector, value )</code>
                    </h4>
                    <div class="detail">
                        <p>给符合选择器的所有元素添加指定 class.</p>
                    </div>
                </div>

                <div class="member method">
                    <h4>
                        <a name="method_removeClass">removeClass</a>
                        <code>void <em>removeClass</em> ( selector, value )</code>
                    </h4>
                    <div class="detail">
                        <p>给符合选择器的所有元素移除指定 class.</p>
                    </div>
                </div>

                <div class="member method">
                    <h4>
                        <a name="method_replaceClass">replaceClass</a>
                        <code>void <em>replaceClass</em> ( selector, oldClassName, newClassName )</code>
                    </h4>
                    <div class="detail">
                        <p>将符合选择器的所有元素的老 class 替换为新 class.</p>
                    </div>
                </div>

                <div class="member method">
                    <h4>
                        <a name="method_toggleClass">toggleClass</a>
                        <code>void <em>toggleClass</em> ( selector, value, state )</code>
                    </h4>
                    <div class="detail">
                        <p>操作符合选择器的所有元素，如果存在值为 value 的 class, 则移除掉，反之添加。</p>
                        <p class="tips">state 参数为 true 时，强制添加，反之移除。</p>
                    </div>
                </div>

            </div>

            <div class="section">
                <h3>Examples</h3>
                <p>测试页面：<a href="http://kissyteam.github.com/kissy/src/dom/test-dom-class.html"><code>test-dom-class.html</code></a></p>

                <div class="section notes">
                    <p>dom-class 提供的所有方法：</p>
                    <ol>
                        <li>参数 selector 可以为数组：<code>DOM.addClass([elem1, elem2], 'val');</code></li>
                        <li>参数 value 都支持用空格分隔的多个值，比如：<code>DOM.addClass('.class', 'product hot');</code></li>
                    </ol>
                </div>
            </div>

        </div>
    </div>
    <div class="col-sub">
        <div class="sub-wrap">
            <div class="loc">
                <a href="../index.html">home</a> &rsaquo;
                <a href="index.html">dom</a> &rsaquo;
                dom-class :
            </div>
            <div class="toc">
                <h3>Methods</h3>
                <ul>
                    <li><a href="#method_hasClass">hasClass</a></li>
                    <li><a href="#method_addClass">addClass</a></li>
                    <li><a href="#method_removeClass">removeClass</a></li>
                    <li><a href="#method_replaceClass">replaceClass</a></li>
                    <li><a href="#method_toggleClass">toggleClass</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div id="footer">
    <p class="copyright">&copy; 2009 - 2029 KISSY UI LIBRARY</p>
</div>
</body>
</html>
